

import onTableAfterEvent from '../request-functions/onTableAfterEvent';

const batchAddSubTemplate = 'batchAddSub';
const batchAddSubTaleTemplate = 'batchAddSubTaleTemplate';

export default function(props, moduleId, key, value, changedRows, record, index) {

    const {
        currentForm
    } = this.state;

    const {
        editTable: {
            getAllData,
            setTableData
        },
        func_type,
        pk_org
    } = this.props;

    let postData = {
        areaCode: currentForm,
        func_type: func_type,
        key: key,
        model: {
            ...getAllData(batchAddSubTaleTemplate),
            areacode: currentForm
        },
        pk_org: pk_org
    };

    onTableAfterEvent(postData)
        .then((res) => {
            if(res.success) {
                if(res.data && res.data.gridData) {
                    setTableData(batchAddSubTaleTemplate, res.data.gridData);
                }
            }
        });

}
